home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Source / Libraries / glut / glut_bitmap.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  1.6 KB  |  49 lines  |  [TEXT/CWIE]

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1994. */
  3.  
  4. /* This program is freely distributable without licensing fees
  5.    and is provided without guarantee or warrantee expressed or
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. #include "glut.h"
  9. #include "glutint.h"
  10. #include "glutbitmap.h"
  11.  
  12. void glutBitmapCharacter(GLUTbitmapFont font, int c)
  13. {
  14.     BitmapCharPtr ch;
  15.     BitmapFontPtr fontinfo = (BitmapFontPtr) font;
  16.     GLint swapbytes, lsbfirst, rowlength;
  17.     GLint skiprows, skippixels, alignment;
  18.  
  19.     if((c < fontinfo->first) || (c >= fontinfo->first + fontinfo->num_chars)) return;
  20.     
  21.     ch = fontinfo->ch[c - fontinfo->first];
  22.     
  23.     if(ch)
  24.     {
  25.         glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
  26.         glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
  27.         glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
  28.         glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
  29.         glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
  30.         glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
  31.  
  32.         glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
  33.         glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
  34.         glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
  35.         glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
  36.         glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
  37.         glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  38.         glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
  39.             ch->advance, 0, ch->bitmap);
  40.  
  41.         glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
  42.         glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
  43.         glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
  44.         glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
  45.         glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
  46.         glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
  47.     }
  48. }
  49.